package com.second.app.designpattern.observer;
import java.util.ArrayList;
import java.util.List;


/**
 * @Author GYZ
 * @Date 2023/11/10
 * <pre>
 *
 * </pre>
 */
public class LolSubject implements Subject {

    //今日比赛信息
    private String msg;

    //后几日比赛信息
    private List<String> msgList;

    public String getMsg() {
        return msg;
    }

    public List<String> getMsgList() {
        return msgList;
    }


    public LolSubject(String msg, List<String> msgList) {
        this.msg = msg;
        this.msgList = msgList;
    }

    private static final List<Observer> observers = new ArrayList<>();

    @Override
    public void registerObserver(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void notifyObservers() {
        for (Observer observer : observers) {
            observer.update();
        }
    }
}
